#include "serversocket.h"

ServerSocket::ServerSocket()
{
}

ServerSocket::ServerSocket(const SocketAddress& address, int backlog)
{
    Socket::bind(address, true);
    Socket::listen(backlog);
}

ServerSocket::ServerSocket(unsigned int port, int backlog)
{
    SocketAddress address("0.0.0.0", port);
    Socket::bind(address, true);
    Socket::listen(backlog);
}

ServerSocket::~ServerSocket()
{
}

ServerSocket::ServerSocket(const Socket& socket):Socket(socket)
{
}

ServerSocket& ServerSocket::operator = (const Socket& socket)
{
    Socket::operator = (socket);
    return *this;
}

void ServerSocket::bind(const SocketAddress& address, bool reuseAddress)
{
    Socket::bind(address, reuseAddress);
}

void ServerSocket::bind(unsigned int port, bool reuseAddress)
{
    SocketAddress address("0.0.0.0", port);
    Socket::bind(address, reuseAddress);
}

void ServerSocket::listen(int backlog)
{
    Socket::listen(backlog);
}


